' Deletes all fieldvalues in one-dimensional Array
Sub ClearArray(BigArray)
Dim i as integer
For i = Lbound(BigArray()) to Ubound(BigArray())
BigArray(i) = ""
Next
End Sub
' Deletes all fieldvalues in a multidimensional Array
Sub ClearMultiDimArray(BigArray,DimCount as integer)
Dim n%, m%
For n = Lbound(BigArray(),1) to Ubound(BigArray(),1)
For m = 0 to Dimcount - 1
BigArray(n,m) = ""
Next m
Next n
End Sub
' Checks if a Field (LocField) is already defined in an Array
' Returns 'True' or 'False'
Function FieldinArray(LocArray(), MaxIndex as integer, LocField as String) As Boolean
Dim i as integer
For i = Lbound(LocArray()) to MaxIndex
If Ucase(LocArray(i)) = Ucase(LocField) Then
FieldInArray = True
Exit Function
End if
Next
FieldInArray = False
End Function
' Checks if a Field (LocField) is already defined in an Array
' Returns 'True' or 'False'
Function FieldinList(LocField, BigList()) As Boolean
Dim i as integer
For i = Lbound(BigList()) to Ubound(BigList())
If LocField = BigList(i) Then
FieldInList = True
Exit Function
End if
Next
FieldInList = False
End Function
' Retrieves the Index of the delivered String 'SearchString' in
' the Array LocList()'
Function IndexinArray(SearchString as String, LocList()) as Integer
Dim i as integer
For i = Lbound(LocList(),1) to Ubound(LocList(),1)
If Ucase(LocList(i,0)) = Ucase(SearchString) Then
IndexinArray = i
Exit Function
End if
Next
IndexinArray = -1
End Function
Sub MultiArrayInListbox(oDialog as Object, ListboxName as String, ValList(), iDim as Integer)
Dim oListbox as Object
Dim i as integer
Dim a as Integer
a = 0
oListbox = oDialog.GetControl(ListboxName)
oListbox.RemoveItems(0, oListbox.GetItemCount)
For i = 0 to Ubound(ValList(), 1)
If ValList(i) <> "" Then
oListbox.AddItem(ValList(i, iDim-1), a)
a = a + 1
End If
Next
End Sub
' Searches for a String in a two-dimensional Array by querying all Searchindexex of the second dimension
' and delivers the specific String of the ReturnIndex in the second dimension of the Searchlist()
Function StringInMultiArray(SearchList(), SearchString as String, SearchIndex as Integer, ReturnIndex as Integer, Optional MaxIndex as Integer) as String
Dim i as integer
Dim CurFieldString as String
If IsMissing(MaxIndex) Then
MaxIndex = Ubound(SearchList(),1)
End If
For i = Lbound(SearchList()) to MaxIndex
CurFieldString = SearchList(i,SearchIndex)
If Ucase(CurFieldString) = Ucase(SearchString) Then
StringInMultiArray() = SearchList(i,ReturnIndex)
Exit Function
End if
Next
StringInMultiArray() = ""
End Function
' Searches for a Value in multidimensial Array by querying all Searchindices of the passed dimension
' and delivers the Index where it is found.
Function GetIndexInMultiArray(SearchList(), SearchValue, SearchIndex as Integer) as Integer
Dim i as integer
Dim MaxIndex as Integer
Dim CurFieldValue
MaxIndex = Ubound(SearchList(),1)
For i = Lbound(SearchList()) to MaxIndex
CurFieldValue = SearchList(i,SearchIndex)
If CurFieldValue = SearchValue Then
GetIndexInMultiArray() = i
Exit Function
End if
Next
GetIndexInMultiArray() = -1
End Function
' Searches for a Value in multidimensial Array by querying all Searchindices of the passed dimension
' and delivers the Index where the Searchvalue is found as a part string
Function GetIndexForPartStringinMultiArray(SearchList(), SearchValue, SearchIndex as Integer) as Integer
Dim i as integer
Dim MaxIndex as Integer
Dim CurFieldValue
MaxIndex = Ubound(SearchList(),1)
For i = Lbound(SearchList()) to MaxIndex
CurFieldValue = SearchList(i,SearchIndex)
If Instr(CurFieldValue, SearchValue) > 0 Then
GetIndexForPartStringinMultiArray() = i
Exit Function
End if
Next
GetIndexForPartStringinMultiArray = -1
End Function
Function ArrayfromMultiArray(MultiArray as String, iDim as Integer)
Dim MaxIndex as Integer
Dim i as Integer
MaxIndex = Ubound(MultiArray())
Dim ResultArray(MaxIndex) as String
For i = 0 To MaxIndex
ResultArray(i) = MultiArray(i,iDim)
Next i
ArrayfromMultiArray() = ResultArray()
End Function
' Replaces the string "OldReplace" through the String "NewReplace" in the String
' 'BigString'
Function ReplaceString(ByVal Bigstring, NewReplace, OldReplace as String) as String